/* components */
import AllotMapDialogComponents from '@src/modules/task/taskTypes/allot/components/AllotMapDialog/AllotMapDialogComponents'
import PlanTimeDialog from '@src/modules/task/view/components/PlanTimeDialog.vue'
import CalendarPlanTimeDialog from '@src/modules/task/view/components/CalendarPlanTimeDialog.vue'
import BatchAllotDialog from '@src/modules/task/taskTypes/allot/components/BatchAllotDialog/BatchAllotDialog.tsx'
import TaskMapInfoWindow from '@src/modules/task/components/TaskAllotModal/TaskMapInfoWindow/TaskMapInfoWindow.tsx'
/* config */
import TaskConfig from '@model/config/TaskConfig'
/* entity */
import EsTask from '@model/entity/EsTask'
import TaskType from '@model/entity/TaskType'
import Field from '@model/entity/Field'
/* model */
import { AllotMapDialogMarker } from '@src/modules/task/taskTypes/allot/components/AllotMapDialog/AllotMapDialogModel'
/* vue */
import { Prop, Ref } from 'vue-property-decorator'

import { MapTypeEnum } from '@model/enum/MapEnum'

class AllotMapDialogData extends AllotMapDialogComponents {
  
  @Ref() readonly BatchAllotDialogComponent!: BatchAllotDialog
  @Ref() readonly PlanTimeDialogComponent!: PlanTimeDialog
  @Ref() readonly CalendarPlanTimeDialogComponent!: CalendarPlanTimeDialog
  /* 工单地图信息弹窗组件 */
  @Ref() readonly TaskMapInfoWindowComponent!: TaskMapInfoWindow
  
  @Prop() readonly advancedSearchParams: Record<string, any> | undefined
  /* 是否开启了新版工单指派 */
  @Prop() readonly restructAllot: boolean | undefined
  @Prop() readonly taskIdList: string[] | undefined
  @Prop() readonly taskConfig: TaskConfig | undefined
  /* 地图模式 */
  @Prop() readonly mapShow: boolean | undefined
  
  /* 地图对象 */
  public AllotMap: AMap.Map | undefined = undefined
    /* 地图所有标记 */
  public markerList: Array<AMap.Marker | null> = []
  /* 当前选择的标记工单 */
  public currentSelectedMarkTask: AllotMapDialogMarker = { data: undefined, index: -1 }
  /* 当前选择的标记工单的计划时间字段 */
  public currentSelectedMarkTaskPlantimeField: Field | null | undefined = undefined
  /* 是否含有下一页数据 */
  public hasNextPage: boolean = false
  /* 详细信息弹窗 */
  public infoWindow: AMap.InfoWindow = new AMap.InfoWindow({ offset: new AMap.Pixel(0, -28) })
  /* 加载状态 */
  public loading: boolean = false
  /* 标记点对象 */
  public markerMap: Record<string, AMap.Marker> = {}
  /* 搜索参数 */
  public searchParams: Record<string, any> = {
    page: 1,
    pageSize: 50
  }
  /* 工单地图数据 */
  public taskMapData: EsTask[] = []
  /* 工单类型列表 */
  public taskTypes: TaskType[] = []
  /* 工单类型列表对象数据 */
  public taskTypesMap: Record<string, TaskType> = {}
  /* 地图侧栏显示状态 */
  public visibleMapSide: boolean = true
  /* 是否显示地图弹窗信息 */
  public visibleMapInfoWindow: boolean = false
  public currentMapType = null
}

export default AllotMapDialogData
